﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Settings
{
    public class LocalSettings
    {
        private static readonly object _lock = new object();
        public static string ConnectionString
        {
            get { return System.Configuration.ConfigurationManager.ConnectionStrings["MSSQLConnectionString"].ConnectionString; }
        }

        public static string WebserviceAddress
        {
            get
            {
                return System.Configuration.ConfigurationManager.AppSettings["WebserviceAddress"];
            }
        }

        public static int CooperateID
        {
            get
            {
                return int.Parse(System.Configuration.ConfigurationManager.AppSettings["CooperateID"]);
            }
        }

        public static int TimeExpired
        {
            get
            {
                int retValue;
                if (int.TryParse(System.Configuration.ConfigurationManager.AppSettings["TimeExpired"], out retValue))
                    return retValue;
                return 60;
            }
        }

        private static bool _turnonsendmessage = true;
        public static bool TurnOnSendMessage
        {
            get { return _turnonsendmessage; }
            set
            {
                lock (_lock)
                {
                    _turnonsendmessage = value;
                }
            }
        }
    }
}
